/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author alberto
 */
@Entity
@Table(name = "mesas")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Mesas.findAll", query = "SELECT m FROM Mesas m"),
    @NamedQuery(name = "Mesas.findByIdmesa", query = "SELECT m FROM Mesas m WHERE m.idmesa = :idmesa"),
    @NamedQuery(name = "Mesas.findByCapacidad", query = "SELECT m FROM Mesas m WHERE m.capacidad = :capacidad"),
    @NamedQuery(name = "Mesas.findByEstatus", query = "SELECT m FROM Mesas m WHERE m.estatus = :estatus")})
public class Mesas implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "IDMESA")
    private Integer idmesa;
    @Column(name = "CAPACIDAD")
    private Integer capacidad;
    @Column(name = "ESTATUS")
    private Boolean estatus;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idmesa")
    private Collection<Comanda> comandaCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idmesa")
    private Collection<Reservaciones> reservacionesCollection;

    public Mesas() {
    }

    public Mesas(Integer idmesa) {
        this.idmesa = idmesa;
    }

    public Integer getIdmesa() {
        return idmesa;
    }

    public void setIdmesa(Integer idmesa) {
        this.idmesa = idmesa;
    }

    public Integer getCapacidad() {
        return capacidad;
    }

    public void setCapacidad(Integer capacidad) {
        this.capacidad = capacidad;
    }

    public Boolean getEstatus() {
        return estatus;
    }

    public void setEstatus(Boolean estatus) {
        this.estatus = estatus;
    }

    @XmlTransient
    public Collection<Comanda> getComandaCollection() {
        return comandaCollection;
    }

    public void setComandaCollection(Collection<Comanda> comandaCollection) {
        this.comandaCollection = comandaCollection;
    }

    @XmlTransient
    public Collection<Reservaciones> getReservacionesCollection() {
        return reservacionesCollection;
    }

    public void setReservacionesCollection(Collection<Reservaciones> reservacionesCollection) {
        this.reservacionesCollection = reservacionesCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idmesa != null ? idmesa.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Mesas)) {
            return false;
        }
        Mesas other = (Mesas) object;
        if ((this.idmesa == null && other.idmesa != null) || (this.idmesa != null && !this.idmesa.equals(other.idmesa))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Mesas[ idmesa=" + idmesa + " ]";
    }
    
}
